<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var arr = ["刘亦菲", "刘诗诗", "黄轩", "何炅"];
      var randomIndex = Math.floor(Math.random() * arr.length);
      console.log(`被输出的名字是${arr[randomIndex]}`);
      arr.splice(randomIndex - 1, 1);
      // 删除后的数组
      console.log(arr);
    </script>
  </body>
</html>
